package com.itheima.dao;

import com.itheima.pojo.CheckGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface CheckGroupMapper {

    void add(CheckGroup checkGroup);

    void addGroupAnditem(@Param("groupAnditem") List<Map> groupAnditem);


    List<CheckGroup> findPage(@Param("queryString")String queryString);

    @Select("select * from t_checkgroup where id = #{id}")
    CheckGroup findByid(@Param("id")Integer id);

    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id = #{id}")
    List<Integer> findGroupAndItem(@Param("id") Integer id);

    void updata(CheckGroup checkGroupId);

    @Delete("delete from t_checkgroup_checkitem where checkgroup_id=#{checkGroupId}")
    void deleteGroupAndItemById(@Param("checkGroupId")Integer checkGroupId);

    @Delete("delete from t_checkgroup where id=#{id}")
    void delete(@Param("id") Integer id);

    @Select("select * from t_checkgroup")
    List<CheckGroup> findAll();
}
